package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.ShopGoodsOrderItemMapper;
import com.ruoyi.shop.domain.ShopGoodsOrderItem;
import com.ruoyi.shop.service.IShopGoodsOrderItemService;

/**
 * 订单项Service业务层处理
 * 
 * @author jiaodacailei
 * @date 2022-06-12
 */
@Service
public class ShopGoodsOrderItemServiceImpl implements IShopGoodsOrderItemService 
{
    @Autowired
    private ShopGoodsOrderItemMapper shopGoodsOrderItemMapper;

    /**
     * 查询订单项
     * 
     * @param id 订单项主键
     * @return 订单项
     */
    @Override
    public ShopGoodsOrderItem selectShopGoodsOrderItemById(Long id)
    {
        return shopGoodsOrderItemMapper.selectShopGoodsOrderItemById(id);
    }

    /**
     * 查询订单项列表
     * 
     * @param shopGoodsOrderItem 订单项
     * @return 订单项
     */
    @Override
    public List<ShopGoodsOrderItem> selectShopGoodsOrderItemList(ShopGoodsOrderItem shopGoodsOrderItem)
    {
        return shopGoodsOrderItemMapper.selectShopGoodsOrderItemList(shopGoodsOrderItem);
    }

    /**
     * 新增订单项
     * 
     * @param shopGoodsOrderItem 订单项
     * @return 结果
     */
    @Override
    public int insertShopGoodsOrderItem(ShopGoodsOrderItem shopGoodsOrderItem)
    {
        shopGoodsOrderItem.setCreateTime(DateUtils.getNowDate());
        return shopGoodsOrderItemMapper.insertShopGoodsOrderItem(shopGoodsOrderItem);
    }

    /**
     * 修改订单项
     * 
     * @param shopGoodsOrderItem 订单项
     * @return 结果
     */
    @Override
    public int updateShopGoodsOrderItem(ShopGoodsOrderItem shopGoodsOrderItem)
    {
        shopGoodsOrderItem.setUpdateTime(DateUtils.getNowDate());
        return shopGoodsOrderItemMapper.updateShopGoodsOrderItem(shopGoodsOrderItem);
    }

    /**
     * 批量删除订单项
     * 
     * @param ids 需要删除的订单项主键
     * @return 结果
     */
    @Override
    public int deleteShopGoodsOrderItemByIds(Long[] ids)
    {
        return shopGoodsOrderItemMapper.deleteShopGoodsOrderItemByIds(ids);
    }

    /**
     * 删除订单项信息
     * 
     * @param id 订单项主键
     * @return 结果
     */
    @Override
    public int deleteShopGoodsOrderItemById(Long id)
    {
        return shopGoodsOrderItemMapper.deleteShopGoodsOrderItemById(id);
    }
}
